﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using App.Core.Extensions;
using App.Data;

public partial class Pages_Admin_ContentList : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        BindPageInfo();
        if (!IsPostBack)
        {
            BindContentList(1);
        }
    }
    protected void BindPageInfo()
    {
        Page.Title = WebUtil.GetPageTitle(h4Heding.InnerHtml); 
    }
    protected void BindContentList(int pageNumber)
    {
        UtilityDAO dao = new UtilityDAO();
        int totalRecord = 0;
        DataSet ds = dao.GetPagedData(AppSQL.GET_CONTENT_LIST, null, pageNumber, ConfigReader.ContentListSize, out totalRecord);
        rptContentList.DataSource = ds.Tables[0];
        //ucContentList.EditLink = "/Pages/Admin/ContentChange.aspx?" + AppConstants.QueryString.ID + "={0}";
        //ucContentList.LinkFields = "ID";
        //ucContentList.NoRecordMessgae = "No Content Found.";
        rptContentList.DataBind();


        ///Bind the Pager Control
        ucContentListPager.TotalRecord = totalRecord;
        ucContentListPager.PageNo = pageNumber;
        ucContentListPager.PageSize = ConfigReader.ContentListSize;
        ucContentListPager.TotalRecordMessage = "Total {0} Content(s) Found.";
        ucContentListPager.DataBind();
    }
    protected void ucContentListPager_PageIndexChanged(object sender, PagerEventArgs e)
    {
        BindContentList(e.PageIndex);
    }
}